import { createRouter, createWebHashHistory, RouteRecordRaw } from 'vue-router';
import Home from '@/views/home/index.vue'
const routes: Array<RouteRecordRaw> = [
  {
    path: '/',
		redirect:'/home'
  },
	{
		path: '/',
    component: Home,
		children:[
			{
				path: '/home',
				component:()=> import(/* webpackChunkName: "home" */'@/views/home/home-main.vue'),
			},
			{
				path: '/order',
				name:"order",
				component:()=> import(/* webpackChunkName: "order" */'@/views/order/index.vue'),
				meta: {
					keepAlive: true //需要被缓存
				}
			},
			{
				path: '/shop',
				component:()=> import(/* webpackChunkName: "shop" */'@/views/shop/index.vue'),
			},
			{
				path: '/user',
				component:()=> import(/* webpackChunkName: "user" */'@/views/user/index.vue'),
			}
		]
	},
	{
    path: '/login',
		component:()=> import(/* webpackChunkName: "login" */'@/views/login/index.vue'),
  },
	{
    path: '/register',
		component:()=> import(/* webpackChunkName: "register" */'@/views/login/register.vue'),
  },
	{
    path: '/addressList',
		component:()=> import(/* webpackChunkName: "register" */'@/views/address/index.vue'),
  },
	{
    path: '/addressEdit',
		component:()=> import(/* webpackChunkName: "register" */'@/views/address/addressEdit.vue'),
  },
	{
    path: '/search',
		component:()=> import(/* webpackChunkName: "search" */'@/views/search/index.vue'),
  },
	{
    path: '/searchResult',
		component:()=> import(/* webpackChunkName: "search" */'@/views/search/searchResult.vue'),
  },
	{
    path: '/test',
		component:()=> import(/* webpackChunkName: "search" */'@/views/testview/index.vue'),
  }
]

const router = createRouter({
  history: createWebHashHistory(),
  routes
})

export default router